<?php

require_once( '../datasources/connections/ConnectionManager.php' );

class DataSourceManager {
	
	const BASE_PATH = '../ormbase' ;
	
	const ENVIROMENT_LOCAL = 1;
    const ENVIROMENT_PREVIEW = 2;
    const ENVIROMENT_PRODUCTION = 3;
	
	protected static $enviroment = self::ENVIROMENT_LOCAL ;
	
	
	
    public static function query( ORMBaseQuery $query ) {
		$class = $query->getClass() ;
		$baseClass = 'Base'.$class ;
		require_once( self::BASE_PATH.'/'.$baseClass.'.php' );
		
		// Todo: wyprodukowanie polaczenia
		$connection = ConnectionManager::factory( call_user_func( array( $baseClass, 'getManager' ) ), self::$enviroment  );
		
		// jesli polacznie nie obsluguje samo query
		
		return ConnectionManager::standardQueryToSql( $query );
    }
	
	public function execute( ) {
		
		
	}
	
	public function setEnviroment( $enviroment ) {
		self::$enviroment = $enviroment;
	}
	
	public function getEnviroment( $enviroment ) {
		
	}
	
}


?>
